package com.cskaoyan.controller.wx.ddp;

import com.cskaoyan.module.bean.BaseRespVo;
import com.cskaoyan.module.ddp.bo.CouponMyListParamsBo;
import com.cskaoyan.module.ddp.vo.CouponListVo;
import com.cskaoyan.module.ddp.vo.CouponVo;
import com.cskaoyan.module.ddp.vo.FootPrintVo;
import com.cskaoyan.module.pojo.MarketCoupon;
import com.cskaoyan.module.pojo.MarketCouponUser;
import com.cskaoyan.module.pojo.MarketGoods;
import com.cskaoyan.module.pojo.MarketUser;
import com.cskaoyan.service.PopularizeService;
import com.cskaoyan.service.wx.ddp.FootPrintService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * PopularizeController
 *
 * @param
 * @return
 * @2022/4/6
 **/
@RestController
@RequestMapping("wx/footprint")
public class FootPrintVXController {


    @Autowired
    @Qualifier("footPrintServiceImpl")
    FootPrintService footPrintService;
    @RequestMapping("list")
    public BaseRespVo<FootPrintVo> list(CouponMyListParamsBo params) {
        FootPrintVo result=null;
        BaseRespVo ok=null;
        result=footPrintService.list(params);
        System.out.println("历史足迹： result = " + result);
        if (result != null) {
            return
                    BaseRespVo.ok(result);
        } else {
            return BaseRespVo.invalidData("显示历史足迹出错！");
        }
    }

    @RequestMapping("delete")
    public BaseRespVo<FootPrintVo> delete(@RequestBody Map id) {

        FootPrintVo result=new FootPrintVo();

        Integer id1 = (Integer) id.get("id");
        int code = footPrintService.delete(id1);
        System.out.println("删除历史足迹code = " + code);
        if (code==1) {
            return BaseRespVo.ok(null);
        } else {
            return BaseRespVo.invalidData("删除历史足迹失败");
        }
    }
}
